package org.clubJava.calc;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;

public class Index extends WebPage{

	private static final long serialVersionUID = 1L;
	private Label label = new Label("test","esto es una prueba");
	int dummy = 0;
	
	public Index() {
		final Form form = new Form("form");
		label.setOutputMarkupId(true);
		form.add(label);
		form.add(new AjaxButton("myButton") {
			private static final long serialVersionUID = 1L;
			@Override
			protected void onSubmit(final AjaxRequestTarget target,final Form form) {
				label.setModelObject(dummy);
				dummy++;
				target.addComponent(label);
			}
		});
		add(form);
		/*
		add(new AjaxLink("myLink") {
			private static final long serialVersionUID = 1L;
			@Override
			public void onClick(AjaxRequestTarget target) {
				label.setModelObject(dummy);
				dummy++;
				target.addComponent(label);
			}
		});
		*/
	}

}
